// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Logging/LogMacros.h"
#include "UintAccessLibrary.generated.h"

/**
 *
 */

DECLARE_LOG_CATEGORY_EXTERN(UintAccessLibraryLog, Log, All);

UCLASS()
class UINTACCESS_API UUintAccessLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
protected:
	UFUNCTION(BlueprintCallable, Category = "UintAccess|Save")
		static bool SaveStringToFile(FString Content, FString filename);
	UFUNCTION(BlueprintCallable, Category = "UintAccess|Load")
		static bool LoadFileToString(FString& Content, FString filename);
	UFUNCTION(BlueprintCallable, Category = "UintAccess|Save")
		static bool SaveStringArrayToFile(TArray<FString> Content, FString filename);
	UFUNCTION(BlueprintCallable, Category = "UintAccess|Load")
		static bool LoadFileToStringArray(TArray<FString>& Content, FString filename);
public:
	static bool SaveString(FString& Content, const TCHAR* Filename);
	static bool LoadString(FString& Content, const TCHAR* Filename);
	static bool SaveStringArray(TArray<FString>& Contents, const TCHAR* Filename);
	static bool LoadStringArray(TArray<FString>& Contents, const TCHAR* Filename);

	template<typename AccessedType>
	static bool SaveData(AccessedType& Content, const TCHAR* Filename);

	template<typename AccessedType>
	static bool LoadData(AccessedType& Content, const TCHAR* Filename);
};

